package com.atguigu.eduservice.controller;

import com.atguigu.common.R;
import com.atguigu.eduservice.entity.EduVideo;
import com.atguigu.eduservice.service.EduVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-04-13
 */
@RestController
@RequestMapping("/eduservice/video")
@Api(description="课程管理 不可用")
@CrossOrigin
public class EduVideoController {

    @Autowired
    private EduVideoService videoService;

    //1 添加小节
    @PostMapping("addVideo")
    @ApiOperation(value = "添加小节")
    public R addVideo(@RequestBody EduVideo eduVideo) {
        videoService.save(eduVideo);
        return R.ok();
    }

    //2 删除小节
    //TODO 完善删除小节，删除阿里云视频
    @ApiOperation(value = "删除小节")
    @DeleteMapping("{id}")
    public R deleteVideo(@PathVariable String id) {
        videoService.removeVideoId(id);
        return R.ok();
    }

    //TODO 修改小节
}

